<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="../../js/tools/jquery-1.4.2.min.js"></script>

<style>
table{table-layout:fixed;font-size:12px;}
  tr{background-color:#F1F6F6;}
  td{border:1px solid #D9D9D9;color:black;padding:2px;}
</style>
<script type="text/javascript">
     function checkPassword()
     {
        var oldpassword=$.trim($("#oldpassword").val());
        var password=$.trim($("#password").val());
        var password2 =$.trim($("#password2").val());
        
        if(oldpassword=="")
        {
           alert("原始密码不能为空！");
           return false;
        }else if(password==""||password2=="")
        {
           alert("新密码不能为空！");
           return false;
        }else if(password.length<6||password2.legnth>15)
        {
           alert("新密的长度为6~14！");
           return false;
        }
        else if(password!=password2)
        {
           alert("两次输入密码不一致！");
           return false;
        }
        return true;
     }
     function modifyPassword()
     {
        var isSuccess=checkPassword();
        if(isSuccess)
        {
           var oldpassword=$.trim($("#oldpassword").val());
           var password=$.trim($("#password").val());
          
   var date =new Date();           $.getJSON("../../groupbyajax/user!modifyUserPassword.action?date="+date.getTime(),{oldPassword:oldpassword,password:password},
   function(data){

				   if(data.success=="PassError")
				   {
				   	 alert("原始密码不对！");
				   }else if(data.success=="nologin")
				   {
				   	  alert("用户没有登录！");
				   }else
				   {
				   	  if(data.success)
					   {
					   	  alert("修改成功！");
					   }else
					   {
					   	alert("修改失败！");
					   }
					
				   }
	
            });
        }
     }
</script>
</head>
<body>
 
 <table  style="width:80%;" align="center">
 <tr><td width="300">原始密码：</td><td><input type="text" id="oldpassword"/></td></tr>
 <tr>
    <td >新密码:</td>
    <td>
       <input type="text" id="password"/>
    </td>
</tr>
<tr>
    <td >确认新密码:</td>
    <td>
       <input type="text" id="password2"/>
    </td>
</tr>
<tr>
    <td colspan="2" align="center">
       <input type="button" value="保存" onclick="modifyPassword()">
    </td>
</tr>
</table>

</body>
</html>